﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace SuspectPhoto
{
    /// <summary>
    /// 摄像头SDK封装类
    /// </summary>
    public static class CameraDevice
    {
        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_Init", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static bool GT_DEV_Init();

        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_Online_Check", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static bool GT_DEV_Online_Check(string ip, ushort port);

        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_GetSDKVersion", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static uint GT_DEV_GetSDKVersion();

        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_Login", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static int GT_DEV_Login(string ip, ushort port, string userName, string password, IntPtr deviceInfo, ref int err);

        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_Logout", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static bool GT_DEV_Logout(long loginID);

        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_RealPlay", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static int GT_DEV_RealPlay(int loginID, int nChannelID, IntPtr hWnd, int rType);

        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_SnapPicture", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static bool GT_DEV_SnapPicture(int loginID, int channelID, string path);

        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_CapturePicture", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static bool GT_DEV_CapturePicture(int realHandle, string path);

        [DllImport("gtnetsdk.dll", EntryPoint = "GT_DEV_SetRealDataCallBack", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public extern static bool GT_DEV_SetRealDataCallBack(long realHandle, GetRealDataCallBack cbRealData, int dwUser, int dwFlag);
    }
}
